import 'package:flutter/material.dart';

import '../../foundation/decoration/linear_gradient_decoration.dart';
import '../../foundation/style/bold_text_style.dart';
import '../container/radius_container.dart';

/// FileName public_tag
///
/// @Author lax
/// @Date 2024/3/14
///
/// @Description

class PublicTag extends StatelessWidget {
  final String? text;

  late final TextStyle? style;

  final double? radius;

  final EdgeInsets? margin;

  final EdgeInsets? padding;

  final List<Color>? colors;

  final Decoration? decoration;

  PublicTag({
    super.key,
    this.text,
    TextStyle? style,
    this.radius = 3,
    this.margin,
    this.padding = const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
    this.colors,
    this.decoration,
  }) {
    this.style = style ?? BoldTextStyle(fontSize: 12, color: Colors.white);
  }

  @override
  Widget build(BuildContext context) {
    if (text == null) {
      return const SizedBox();
    }

    return RadiusContainer(
      margin: margin,
      padding: padding,
      decoration: decoration ??
          LinearGradientDecoration(
            radius: radius,
            colors: colors,
          ),
      child: Text(text ?? '', style: style),
    );
  }
}
